<?
/*
-------------------------------
Script - EvaGb
-------------------------------
File - onlinereplace_inc.php
-------------------------------
Function - Функции для замены текста при выводе
-------------------------------
*/
function code_replace($text) {
   $text[1]=str_replace(array(" ","\r\n"),array("&nbsp;","<br>"),$text[1]);
   return "<div class='code'>&nbsp;<span style='color:#000;font-style:normal;'><b><u>CODE:</u></b></span><br>{$text[1]}</div>";
}
function php_replace($text) {
    $text=$text[1];
    $text=str_replace(array("&nbsp;","<br>"),array(" ","\r\n"),$text);
    $text=html_entity_decode($text,ENT_QUOTES);
   if (!strpos($text,"<?")==false) $text="<?".$text;
   if (!strpos($text,"?".">")) $text.="?".">";
   return "<div class='php'>&nbsp;<span style='color:#000;font-style:normal;'><b><u>PHP:</u></b></span><br>".highlight_string($text,1)."</div>";
}
function onlinereplace($text) {
    $text=preg_replace_callback("#\[code\](.+)\[\/code\]#iUs","code_replace",$text);
    $text=preg_replace_callback("#\[php\](.+)\[\/php\]#iUs","php_replace",$text);
    return $text;
}


?>
